#define _CRT_SECURE_NO_WARNINGS 1
#include"Contact.h"

void menu()
{
	printf("****************************\n");
	printf("***1. Add    *  2. Delete***\n");
	printf("***3. Select *  4. Modify***\n");
	printf("***5. Show   *  6. Qsort ***\n");
	printf("***7. Reset  *  0. Exit  ***\n");
	printf("****************************\n");
}
enum Selection
{
	Exit,
	Add,
	Delete,
	Select,
	Modify,
	Show,
	Qsort,
	Reset
};
int main()
{
	Contact con;
	InitContact(&con);
	int input = 0;
	menu();
	do
	{
		printf("Please enter your operation:\n");
		scanf("%d", &input);
		switch (input)
		{
		case Add:
			AddContact(&con);
			break;
		case Delete:
			DeleteContact(&con);
			break;
		case Select:
			SelectContact(&con);
			break;
		case Modify:
			ModifyContact(&con);
			break;
		case Show:
			ShowContact(&con);
			break;
		case Qsort:
			QsortContact(&con);
			break;
		case Reset:
			ResetContact(&con);
			break;
		case Exit:
			SaveContact(&con);
			DestroyContact(&con);
			printf("Welcome to next use");
			break;
		default:
			printf("No operation.Please reenter:\n");
			menu();
			break;
		}
	} while (input);
	return 0;
}